#include <iostream>

class Solution
{
public:
    int main()
    {
        int startHour, startMinute, endHour, endMinute;
        std::cin >> startHour >> startMinute >> endHour >> endMinute;
        int diffHour = endHour - startHour;
        int diffMinute = endMinute - startMinute;
        if (diffMinute < 0)
        {
            diffMinute += 60;
            diffHour -= 1;
        }
        std::cout << diffHour << " " << diffMinute;
        return 0;
    }
};

#ifndef __LOCAL_TEST__
int main()
{
    return Solution().main();
}
#endif